/* 
* TODO: 1. Place the .txt data file and the dictionary file you downloaded in the work folder, or enter the full path to these files!
*       2. You may have to increase memory using the 'set mem' statement. It is commented out in the code bellow.
*
* If you have any questions or need assistance contact info@socialexplorer.com.
*/

///set mem 512m
clear all
version 11
set more off
cd "C:\Users\hd233\Dropbox\Yale\Research\APEEP\data\income"
infile using "ACS2012_5yr_R12408298.dct", using("ACS2012_5yr_R12408298_SL050.txt")

destring FIPS, generate(fips)
ren A14024_001 income_2000usd
ren A00001_001 pop
keep fips income* pop
codebook income* pop

/*
-----------------------------------------------------------------------------------------------------------------------------
income_2000usd                               Per Capita Income (In 2012 Inflation Adjusted Dollars) [Dollars adjusted for inf
-----------------------------------------------------------------------------------------------------------------------------

                  type:  numeric (double)

                 range:  [4507.24,46421.949]          units:  1.000e-06
         unique values:  2932                     missing .:  0/3221

                  mean:   17258.3
              std. dev:   4422.31

           percentiles:        10%       25%       50%       75%       90%
                           12815.1   14602.3   16869.7   19374.8   22153.3
---------------------------------------------------------------------------------------------------------------------------------
pop                                                                                                              Total Population
---------------------------------------------------------------------------------------------------------------------------------

                  type:  numeric (long)

                 range:  [66,9840024]                 units:  1
         unique values:  3161                     missing .:  0/3221

                  mean:   97129.9
              std. dev:    310085

           percentiles:        10%       25%       50%       75%       90%
                              5240     11320     26001     65958    195024


*/

compress
saveold data_income_pop_2010_acs, replace
